﻿    <Window x:Class="AppTrans.MainWindow"
        xmlns:local="clr-namespace:AppTrans"
        Title="Система учета грузовых перевозок (Версия 3.2.11 от 28.07.2017)"
        WindowStartupLocation="CenterScreen"
        xml:lang="ru-RU"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Closing="MainWindow_Closing"
        xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit" 
        xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
        xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"
        xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core">
    
    <Window.CommandBindings>
        <CommandBinding Command="Save" 
                        Executed="saveCommandBinding_Executed" />
        <CommandBinding Command="local:Commands.RunSQL"
                        Executed="RunSQL_Executed"/>
        <CommandBinding Command="Refresh" 
                        Executed="refreshCommandBinding_Executed" />
        <CommandBinding Command="local:Commands.Exit" 
                        Executed="exitCommandBinding_Executed" />
        <CommandBinding Command="local:Commands.About"
                        Executed="aboutCommandBinding_Executed"/>
        <CommandBinding Command="local:Commands.Hotkeys"
                        Executed="HotkeysCommandBinding_Executed"/>
        <CommandBinding Command="local:Commands.Instruction"
                        Executed="InstructionCommandBinding_Executed"/>
        <CommandBinding Command="local:Commands.VerDB"
                        Executed="VerDB_Executed"/>
        <CommandBinding Command="local:Commands.CheckErrors"
                        Executed="CheckErrors_Executed"/>
        <CommandBinding Command="local:Commands.CheckDateParam"
                        Executed="CheckDateParam_Executed"/>
        <CommandBinding Command="local:Commands.BackupDB"
                        Executed="BackupDB_Executed"/>
        <CommandBinding Command="local:Commands.DebugMode"
                        Executed="DebugMode_Executed"/>
    </Window.CommandBindings>

    <Window.Resources>
        <Style x:Key="DataGridStyle">
            <Setter Property="DataGrid.AutoGenerateColumns" Value="False" />
            <Setter Property="DataGrid.CanUserAddRows" Value="True" />
            <Setter Property="DataGrid.CanUserDeleteRows" Value="True"/>
            <Setter Property="DataGrid.CanUserReorderColumns" Value="False" />
            <Setter Property="DataGrid.CanUserResizeRows" Value="True" />
            <Setter Property="DataGrid.CanUserSortColumns" Value="False" />
            <Setter Property="DataGrid.Background" Value="LightGray" />
            <Setter Property="DataGrid.RowBackground" Value="LightYellow" />
            <Setter Property="DataGrid.AlternatingRowBackground" Value="LightBlue" />
            <Setter Property="DataGrid.ClipboardCopyMode" Value="IncludeHeader"/>
        </Style>
    </Window.Resources>

    <DockPanel Name="MainPanel">
        <Menu DockPanel.Dock="Top">
            <MenuItem Header="_File" Click="MenuItem_Click">
                <MenuItem Command="Save" Header="_Save" />
                <MenuItem Command="Refresh" Header="_Refresh reports" />
                <Separator/>
                <MenuItem Command="local:Commands.Exit"/>
            </MenuItem>
            <MenuItem Header="_System">
                <MenuItem Command="local:Commands.RunSQL" Header="_RunSQL" />
                <MenuItem Command="local:Commands.CheckErrors" Header="_CheckErrors" />
                <MenuItem Command="local:Commands.CheckDateParam" Header="_CheckDateParam" />
                <MenuItem Command="local:Commands.VerDB" Header="_CheckVersionDB" />
                <MenuItem Command="local:Commands.BackupDB" Header="_BackupDB" />
                <MenuItem Command="local:Commands.DebugMode" Header="_DebugMode" />
            </MenuItem>
            <MenuItem Header="_Help">
                <MenuItem Command="local:Commands.Hotkeys" />
                <MenuItem Command="local:Commands.Instruction" Header="What's new"/>
                <MenuItem Command="local:Commands.About" />
            </MenuItem>
        </Menu>
        <StatusBar DockPanel.Dock="Bottom">
            <TextBlock Name="StatusBarText" />
        </StatusBar>
        <TabControl>
            <TabItem Header="Работы">
                <TabControl>
                    <TabItem Header="Заявки">
                        <DockPanel>
                            <Button DockPanel.Dock="Top" 
                                    Click="WorksCloneButton_Click8">Клонирование записи - Заявки</Button>
                            <DataGrid Name="WorksDataGrid8"
                                      Style="{StaticResource DataGridStyle}">
                                <DataGrid.Columns>
                                    <DataGridTemplateColumn Header="Дата">
                                        <DataGridTemplateColumn.CellTemplate>
                                            <DataTemplate>
                                                <TextBlock Text="{Binding Path= Date, StringFormat=\{0:d\}}" />
                                            </DataTemplate>
                                        </DataGridTemplateColumn.CellTemplate>
                                        <DataGridTemplateColumn.CellEditingTemplate>
                                            <DataTemplate>
                                                <DatePicker
                                                    SelectedDate="{Binding Path=Date, Mode=TwoWay,ValidatesOnExceptions=true, NotifyOnValidationError=true}" />
                                            </DataTemplate>
                                        </DataGridTemplateColumn.CellEditingTemplate>
                                    </DataGridTemplateColumn>
                                    <DataGridComboBoxColumn
                                            x:Name="WorksOperTypeList8"
                                            DisplayMemberPath="Name"
                                            SelectedValuePath="Id"
                                            SelectedValueBinding="{Binding Path=OperType}"
                                            Header="ТипРаб">
                                    </DataGridComboBoxColumn>
                                    <DataGridComboBoxColumn
                                            x:Name="WorksLoadingPlaceList8"
                                            DisplayMemberPath="Name"
                                            SelectedValuePath="Id"
                                            SelectedValueBinding="{Binding Path=LoadingPlace}"
                                            Header="Место загрузки">
                                    </DataGridComboBoxColumn>
                                    <DataGridComboBoxColumn
                                            x:Name="WorksUnloadingPlaceList8"
                                            DisplayMemberPath="Name"
                                            SelectedValuePath="Id"
                                            SelectedValueBinding="{Binding Path=UnloadingPlace}"
                                            Header="Место разгрузки">
                                    </DataGridComboBoxColumn>
                                    <DataGridComboBoxColumn
                                            x:Name="WorksMachineList8"
                                            DisplayMemberPath="Name"
                                            SelectedValuePath="Id"
                                            SelectedValueBinding="{Binding Path=Machine}"
                                            Header="Машина">
                                    </DataGridComboBoxColumn>
                                    <DataGridComboBoxColumn
                                            x:Name="WorksDriverList8"
                                            DisplayMemberPath="Name"
                                            SelectedValuePath="Id"
                                            SelectedValueBinding="{Binding Path=Driver}"
                                            Header="Водитель">
                                    </DataGridComboBoxColumn>
                                    <DataGridComboBoxColumn
                                            x:Name="WorksGoodsList8"
                                            DisplayMemberPath="Name"
                                            SelectedValuePath="Id"
                                            SelectedValueBinding="{Binding Path=Goods}"
                                            Header="Груз">
                                    </DataGridComboBoxColumn>
                                    <DataGridComboBoxColumn
                                            x:Name="WorksCustomerList8"
                                            DisplayMemberPath="Name"
                                            SelectedValuePath="Id"
                                            SelectedValueBinding="{Binding Path=Customer}"
                                            Header="Заказчик">
                                    </DataGridComboBoxColumn>
                                    <DataGridComboBoxColumn
                                            x:Name="WorksProjectList8"
                                            DisplayMemberPath="Name"
                                            SelectedValuePath="Id"
                                            SelectedValueBinding="{Binding Path=Project}"
                                            Header="Проект">
                                    </DataGridComboBoxColumn>
                                    <DataGridTextColumn
                                            Binding="{Binding Path=Discription}"
                                            Header="Примечание">
                                    </DataGridTextColumn>
                                </DataGrid.Columns>
                            </DataGrid>
                        </DockPanel>
                    </TabItem>
                    <TabItem Header="Продажа+Доставка">
                        <DockPanel>
                            <Button DockPanel.Dock="Top" 
                                    Click="WorksCloneButton_Click">Клонирование записи - (Продажа+Доставка)</Button>
                            <DataGrid Name="WorksDataGrid"
                              Style="{StaticResource DataGridStyle}">
                        <DataGrid.Columns>
                            <DataGridTemplateColumn Header="Дата">
                                <DataGridTemplateColumn.CellTemplate>
                                    <DataTemplate>
                                        <TextBlock Text="{Binding Path= Date, StringFormat=\{0:d\}}" />
                                    </DataTemplate>
                                </DataGridTemplateColumn.CellTemplate>
                                <DataGridTemplateColumn.CellEditingTemplate>
                                    <DataTemplate>
                                        <DatePicker
                                            SelectedDate="{Binding Path=Date, Mode=TwoWay,ValidatesOnExceptions=true, NotifyOnValidationError=true}" />
                                    </DataTemplate>
                                </DataGridTemplateColumn.CellEditingTemplate>
                            </DataGridTemplateColumn>
                            <DataGridComboBoxColumn
                                    x:Name="WorksOperTypeList"
                                    DisplayMemberPath="Name"
                                    SelectedValuePath="Id"
                                    SelectedValueBinding="{Binding Path=OperType}"
                                    Header="ТипРаб">
                            </DataGridComboBoxColumn>
                            <DataGridComboBoxColumn
                                    x:Name="WorksLoadingPlaceList"
                                    DisplayMemberPath="Name"
                                    SelectedValuePath="Id"
                                    SelectedValueBinding="{Binding Path=LoadingPlace}"
                                    Header="Место загрузки">
                            </DataGridComboBoxColumn>
                            <DataGridComboBoxColumn
                                    x:Name="WorksUnloadingPlaceList"
                                    DisplayMemberPath="Name"
                                    SelectedValuePath="Id"
                                    SelectedValueBinding="{Binding Path=UnloadingPlace}"
                                    Header="Место разгрузки">
                            </DataGridComboBoxColumn>
                            <DataGridComboBoxColumn
                                    x:Name="WorksMachineList"
                                    DisplayMemberPath="Name"
                                    SelectedValuePath="Id"
                                    SelectedValueBinding="{Binding Path=Machine}"
                                    Header="Машина">
                            </DataGridComboBoxColumn>
                            <DataGridComboBoxColumn
                                    x:Name="WorksDriverList"
                                    DisplayMemberPath="Name"
                                    SelectedValuePath="Id"
                                    SelectedValueBinding="{Binding Path=Driver}"
                                    Header="Водитель">
                            </DataGridComboBoxColumn>
                            <DataGridTextColumn
                                    Binding="{Binding Path=SalaryDriver}"
                                    Header="ЗарплВод">
                            </DataGridTextColumn>
                            <DataGridComboBoxColumn
                                    x:Name="WorksGoodsList"
                                    DisplayMemberPath="Name"
                                    SelectedValuePath="Id"
                                    SelectedValueBinding="{Binding Path=Goods}"
                                    Header="Груз">
                            </DataGridComboBoxColumn>
                            <DataGridTextColumn
                                    Binding="{Binding Path=WeightDownload}"
                                    Header="Вес загр">
                            </DataGridTextColumn>
                                    <DataGridTextColumn
                                    Binding="{Binding Path=Weight}"
                                    Header="Вес разгр">
                            </DataGridTextColumn>
                            <DataGridTextColumn
                                    Binding="{Binding Path=Distance}"
                                    Header="Км">
                            </DataGridTextColumn>
                            <DataGridComboBoxColumn
                                    x:Name="WorksSupplierList"
                                    DisplayMemberPath="Name"
                                    SelectedValuePath="Id"
                                    SelectedValueBinding="{Binding Path=Supplier}"
                                    Header="Поставщик">
                            </DataGridComboBoxColumn>
                            <DataGridTextColumn
                                    Binding="{Binding Path=PriceOfPurchasing}"
                                    Header="СуммаЗакуп">
                            </DataGridTextColumn>
                            <DataGridComboBoxColumn
                                    x:Name="WorksCurrencyPurchasingList"
                                    DisplayMemberPath="ShortName"
                                    SelectedValuePath="Id"
                                    SelectedValueBinding="{Binding Path=CurrencyPurchasing}"
                                    Header="ВалЗакуп">
                            </DataGridComboBoxColumn>
                            <DataGridComboBoxColumn
                                    x:Name="WorksSupplierCommissionList"
                                    DisplayMemberPath="Name"
                                    SelectedValuePath="Id"
                                    SelectedValueBinding="{Binding Path=SupplierCommission}"
                                    Header="КомиссионерПоставщика">
                            </DataGridComboBoxColumn>
                            <DataGridTextColumn
                                    Binding="{Binding Path=PriceCommissionPurchase}"
                                    Header="СуммаКомисПоставщика">
                            </DataGridTextColumn>
                            <DataGridComboBoxColumn
                                    x:Name="WorksCustomerList"
                                    DisplayMemberPath="Name"
                                    SelectedValuePath="Id"
                                    SelectedValueBinding="{Binding Path=Customer}"
                                    Header="Заказчик">
                            </DataGridComboBoxColumn>
                            <DataGridTextColumn
                                    Binding="{Binding Path=PriceOfSales}"
                                    Header="СуммаПрод">
                            </DataGridTextColumn>
                            <DataGridComboBoxColumn
                                    x:Name="WorksCurrencySalesList"
                                    DisplayMemberPath="ShortName"
                                    SelectedValuePath="Id"
                                    SelectedValueBinding="{Binding Path=CurrencySales}"
                                    Header="ВалПродажи">
                            </DataGridComboBoxColumn>
                            <DataGridComboBoxColumn
                                    x:Name="WorksCustomerCommissionList"
                                    DisplayMemberPath="Name"
                                    SelectedValuePath="Id"
                                    SelectedValueBinding="{Binding Path=CustomerCommission}"
                                    Header="КомиссионерЗаказч">
                            </DataGridComboBoxColumn>
                            <DataGridTextColumn
                                    Binding="{Binding Path=PriceCommissionSales}"
                                    Header="СуммаКомисЗаказч">
                            </DataGridTextColumn>
                            <DataGridComboBoxColumn
                                    x:Name="WorksProjectList"
                                    DisplayMemberPath="Name"
                                    SelectedValuePath="Id"
                                    SelectedValueBinding="{Binding Path=Project}"
                                    Header="Проект">
                            </DataGridComboBoxColumn>
                            <DataGridTextColumn
                                    Binding="{Binding Path=Discription}"
                                    Header="Описание">
                            </DataGridTextColumn>
                        </DataGrid.Columns>
                    </DataGrid>
                </DockPanel>
                    </TabItem>
                    <TabItem Header="Закупка на склад">
                        <DockPanel>
                            <Button DockPanel.Dock="Top" 
                            Click="WorksCloneButton_Click5">Клонирование записи - (Закупка на склад)</Button>
                            <DataGrid Name="WorksDataGrid5"
                              Style="{StaticResource DataGridStyle}">
                                <DataGrid.Columns>
                                    <DataGridTemplateColumn Header="Дата">
                                        <DataGridTemplateColumn.CellTemplate>
                                            <DataTemplate>
                                                <TextBlock Text="{Binding Path= Date, StringFormat=\{0:d\}}" />
                                            </DataTemplate>
                                        </DataGridTemplateColumn.CellTemplate>
                                        <DataGridTemplateColumn.CellEditingTemplate>
                                            <DataTemplate>
                                                <DatePicker
                                            SelectedDate="{Binding Path=Date, Mode=TwoWay,ValidatesOnExceptions=true, NotifyOnValidationError=true}" />
                                            </DataTemplate>
                                        </DataGridTemplateColumn.CellEditingTemplate>
                                    </DataGridTemplateColumn>
                                    <DataGridComboBoxColumn
                                        x:Name="WorksOperTypeList5"
                                        DisplayMemberPath="Name"
                                        SelectedValuePath="Id"
                                        SelectedValueBinding="{Binding Path=OperType}"
                                        Header="ТипРаб">
                                    </DataGridComboBoxColumn>
                                    <DataGridComboBoxColumn
                                        x:Name="WorksLoadingPlaceList5"
                                        DisplayMemberPath="Name"
                                        SelectedValuePath="Id"
                                        SelectedValueBinding="{Binding Path=LoadingPlace}"
                                        Header="Место загрузки">
                                    </DataGridComboBoxColumn>
                                    <DataGridComboBoxColumn
                                        x:Name="WorksUnloadingPlaceList5"
                                        DisplayMemberPath="Name"
                                        SelectedValuePath="Id"
                                        SelectedValueBinding="{Binding Path=UnloadingPlace}"
                                        Header="Место разгрузки">
                                    </DataGridComboBoxColumn>
                                    <DataGridComboBoxColumn
                                        x:Name="WorksMachineList5"
                                        DisplayMemberPath="Name"
                                        SelectedValuePath="Id"
                                        SelectedValueBinding="{Binding Path=Machine}"
                                        Header="Машина">
                                    </DataGridComboBoxColumn>
                                    <DataGridComboBoxColumn
                                        x:Name="WorksDriverList5"
                                        DisplayMemberPath="Name"
                                        SelectedValuePath="Id"
                                        SelectedValueBinding="{Binding Path=Driver}"
                                        Header="Водитель">
                                    </DataGridComboBoxColumn>
                                    <DataGridTextColumn
                                        Binding="{Binding Path=SalaryDriver}"
                                        Header="ЗарплВод">
                                    </DataGridTextColumn>
                                    <DataGridComboBoxColumn
                                        x:Name="WorksGoodsList5"
                                        DisplayMemberPath="Name"
                                        SelectedValuePath="Id"
                                        SelectedValueBinding="{Binding Path=Goods}"
                                        Header="Груз">
                                    </DataGridComboBoxColumn>
                                    <DataGridTextColumn
                                        Binding="{Binding Path=WeightDownload}"
                                        Header="Вес загр">
                                    </DataGridTextColumn>
                                    <DataGridTextColumn
                                        Binding="{Binding Path=Weight}"
                                        Header="Вес разгр">
                                    </DataGridTextColumn>
                                    <DataGridTextColumn
                                        Binding="{Binding Path=Distance}"
                                        Header="Км">
                                    </DataGridTextColumn>
                                    <DataGridComboBoxColumn
                                        x:Name="WorksSupplierList5"
                                        DisplayMemberPath="Name"
                                        SelectedValuePath="Id"
                                        SelectedValueBinding="{Binding Path=Supplier}"
                                        Header="Поставщик">
                                    </DataGridComboBoxColumn>
                                    <DataGridTextColumn
                                        Binding="{Binding Path=PriceOfPurchasing}"
                                        Header="СуммаЗакуп">
                                    </DataGridTextColumn>
                                    <DataGridComboBoxColumn
                                        x:Name="WorksCurrencyPurchasingList5"
                                        DisplayMemberPath="ShortName"
                                        SelectedValuePath="Id"
                                        SelectedValueBinding="{Binding Path=CurrencyPurchasing}"
                                        Header="ВалЗакуп">
                                    </DataGridComboBoxColumn>
                                    <DataGridComboBoxColumn
                                        x:Name="WorksSupplierCommissionList5"
                                        DisplayMemberPath="Name"
                                        SelectedValuePath="Id"
                                        SelectedValueBinding="{Binding Path=SupplierCommission}"
                                        Header="КомиссионерПоставщика">
                                    </DataGridComboBoxColumn>
                                    <DataGridTextColumn
                                        Binding="{Binding Path=PriceCommissionPurchase}"
                                        Header="СуммаКомисПоставщика">
                                    </DataGridTextColumn>
                                    <DataGridComboBoxColumn
                                        x:Name="WorksProjectList5"
                                        DisplayMemberPath="Name"
                                        SelectedValuePath="Id"
                                        SelectedValueBinding="{Binding Path=Project}"
                                        Header="Проект">
                                    </DataGridComboBoxColumn>
                                    <DataGridTextColumn
                                        Binding="{Binding Path=Discription}"
                                        Header="Описание">
                                    </DataGridTextColumn>
                                </DataGrid.Columns>
                            </DataGrid>
                        </DockPanel>
                    </TabItem>
                    <TabItem Header="Продажа со склада">
                        <DockPanel>
                            <Button DockPanel.Dock="Top" 
                            Click="WorksCloneButton_Click6">Клонирование записи - (Продажа со склада)</Button>
                            <DataGrid Name="WorksDataGrid6"
                              Style="{StaticResource DataGridStyle}">
                                <DataGrid.Columns>
                                    <DataGridTemplateColumn Header="Дата">
                                        <DataGridTemplateColumn.CellTemplate>
                                            <DataTemplate>
                                                <TextBlock Text="{Binding Path= Date, StringFormat=\{0:d\}}" />
                                            </DataTemplate>
                                        </DataGridTemplateColumn.CellTemplate>
                                        <DataGridTemplateColumn.CellEditingTemplate>
                                            <DataTemplate>
                                                <DatePicker
                                            SelectedDate="{Binding Path=Date, Mode=TwoWay,ValidatesOnExceptions=true, NotifyOnValidationError=true}" />
                                            </DataTemplate>
                                        </DataGridTemplateColumn.CellEditingTemplate>
                                    </DataGridTemplateColumn>
                                    <DataGridComboBoxColumn
                                        x:Name="WorksOperTypeList6"
                                        DisplayMemberPath="Name"
                                        SelectedValuePath="Id"
                                        SelectedValueBinding="{Binding Path=OperType}"
                                        Header="ТипРаб">
                                    </DataGridComboBoxColumn>
                                    <DataGridComboBoxColumn
                                        x:Name="WorksLoadingPlaceList6"
                                        DisplayMemberPath="Name"
                                        SelectedValuePath="Id"
                                        SelectedValueBinding="{Binding Path=LoadingPlace}"
                                        Header="Место загрузки">
                                    </DataGridComboBoxColumn>
                                    <DataGridComboBoxColumn
                                        x:Name="WorksUnloadingPlaceList6"
                                        DisplayMemberPath="Name"
                                        SelectedValuePath="Id"
                                        SelectedValueBinding="{Binding Path=UnloadingPlace}"
                                        Header="Место разгрузки">
                                    </DataGridComboBoxColumn>
                                    <DataGridComboBoxColumn
                                        x:Name="WorksMachineList6"
                                        DisplayMemberPath="Name"
                                        SelectedValuePath="Id"
                                        SelectedValueBinding="{Binding Path=Machine}"
                                        Header="Машина">
                                    </DataGridComboBoxColumn>
                                    <DataGridComboBoxColumn
                                        x:Name="WorksDriverList6"
                                        DisplayMemberPath="Name"
                                        SelectedValuePath="Id"
                                        SelectedValueBinding="{Binding Path=Driver}"
                                        Header="Водитель">
                                    </DataGridComboBoxColumn>
                                    <DataGridTextColumn
                                        Binding="{Binding Path=SalaryDriver}"
                                        Header="ЗарплВод">
                                    </DataGridTextColumn>
                                    <DataGridComboBoxColumn
                                        x:Name="WorksGoodsList6"
                                        DisplayMemberPath="Name"
                                        SelectedValuePath="Id"
                                        SelectedValueBinding="{Binding Path=Goods}"
                                        Header="Груз">
                                    </DataGridComboBoxColumn>
                                    <DataGridTextColumn
                                        Binding="{Binding Path=WeightDownload}"
                                        Header="Вес загр">
                                    </DataGridTextColumn>
                                    <DataGridTextColumn
                                        Binding="{Binding Path=Weight}"
                                        Header="Вес разгр">
                                    </DataGridTextColumn>
                                    <DataGridTextColumn
                                        Binding="{Binding Path=Distance}"
                                        Header="Км">
                                    </DataGridTextColumn>
                                    <DataGridComboBoxColumn
                                        x:Name="WorksCustomerList6"
                                        DisplayMemberPath="Name"
                                        SelectedValuePath="Id"
                                        SelectedValueBinding="{Binding Path=Customer}"
                                        Header="Заказчик">
                                    </DataGridComboBoxColumn>
                                    <DataGridTextColumn
                                        Binding="{Binding Path=PriceOfSales}"
                                        Header="СуммаПрод">
                                    </DataGridTextColumn>
                                    <DataGridComboBoxColumn
                                        x:Name="WorksCurrencySalesList6"
                                        DisplayMemberPath="ShortName"
                                        SelectedValuePath="Id"
                                        SelectedValueBinding="{Binding Path=CurrencySales}"
                                        Header="ВалПродажи">
                                    </DataGridComboBoxColumn>
                                    <DataGridComboBoxColumn
                                        x:Name="WorksCustomerCommissionList6"
                                        DisplayMemberPath="Name"
                                        SelectedValuePath="Id"
                                        SelectedValueBinding="{Binding Path=CustomerCommission}"
                                        Header="КомиссионерЗаказч">
                                    </DataGridComboBoxColumn>
                                    <DataGridTextColumn
                                        Binding="{Binding Path=PriceCommissionSales}"
                                        Header="СуммаКомисЗаказч">
                                    </DataGridTextColumn>
                                    <DataGridComboBoxColumn
                                        x:Name="WorksProjectList6"
                                        DisplayMemberPath="Name"
                                        SelectedValuePath="Id"
                                        SelectedValueBinding="{Binding Path=Project}"
                                        Header="Проект">
                                    </DataGridComboBoxColumn>
                                    <DataGridTextColumn
                                        Binding="{Binding Path=Discription}"
                                        Header="Описание">
                                    </DataGridTextColumn>
                                </DataGrid.Columns>
                            </DataGrid>
                        </DockPanel>
                    </TabItem>
                    <TabItem Header="Перевозка">
                        <DockPanel>
                            <Button DockPanel.Dock="Top" 
                                    Click="WorksCloneButton_Click2">Клонирование записи - Перевозка</Button>
                            <DataGrid Name="WorksDataGrid2"
                                      Style="{StaticResource DataGridStyle}">
                                <DataGrid.Columns>
                                    <DataGridTemplateColumn Header="Дата">
                                        <DataGridTemplateColumn.CellTemplate>
                                            <DataTemplate>
                                                <TextBlock Text="{Binding Path= Date, StringFormat=\{0:d\}}" />
                                            </DataTemplate>
                                        </DataGridTemplateColumn.CellTemplate>
                                        <DataGridTemplateColumn.CellEditingTemplate>
                                            <DataTemplate>
                                                <DatePicker
                                                    SelectedDate="{Binding Path=Date, Mode=TwoWay,ValidatesOnExceptions=true, NotifyOnValidationError=true}" />
                                            </DataTemplate>
                                        </DataGridTemplateColumn.CellEditingTemplate>
                                    </DataGridTemplateColumn>
                                    <DataGridComboBoxColumn
                                            x:Name="WorksOperTypeList2"
                                            DisplayMemberPath="Name"
                                            SelectedValuePath="Id"
                                            SelectedValueBinding="{Binding Path=OperType}"
                                            Header="ТипРаб">
                                    </DataGridComboBoxColumn>
                                    <DataGridComboBoxColumn
                                            x:Name="WorksLoadingPlaceList2"
                                            DisplayMemberPath="Name"
                                            SelectedValuePath="Id"
                                            SelectedValueBinding="{Binding Path=LoadingPlace}"
                                            Header="Место загрузки">
                                    </DataGridComboBoxColumn>
                                    <DataGridComboBoxColumn
                                            x:Name="WorksUnloadingPlaceList2"
                                            DisplayMemberPath="Name"
                                            SelectedValuePath="Id"
                                            SelectedValueBinding="{Binding Path=UnloadingPlace}"
                                            Header="Место разгрузки">
                                    </DataGridComboBoxColumn>
                                    <DataGridComboBoxColumn
                                            x:Name="WorksMachineList2"
                                            DisplayMemberPath="Name"
                                            SelectedValuePath="Id"
                                            SelectedValueBinding="{Binding Path=Machine}"
                                            Header="Машина">
                                    </DataGridComboBoxColumn>
                                    <DataGridComboBoxColumn
                                            x:Name="WorksDriverList2"
                                            DisplayMemberPath="Name"
                                            SelectedValuePath="Id"
                                            SelectedValueBinding="{Binding Path=Driver}"
                                            Header="Водитель">
                                    </DataGridComboBoxColumn>
                                    <DataGridTextColumn
                                            Binding="{Binding Path=SalaryDriver}"
                                            Header="ЗарплВод">
                                    </DataGridTextColumn>
                                    <DataGridComboBoxColumn
                                            x:Name="WorksGoodsList2"
                                            DisplayMemberPath="Name"
                                            SelectedValuePath="Id"
                                            SelectedValueBinding="{Binding Path=Goods}"
                                            Header="Груз">
                                    </DataGridComboBoxColumn>
                                    <DataGridTextColumn
                                        Binding="{Binding Path=WeightDownload}"
                                        Header="Вес загр">
                                    </DataGridTextColumn>
                                    <DataGridTextColumn
                                        Binding="{Binding Path=Weight}"
                                        Header="Вес разгр">
                                    </DataGridTextColumn>
                                    <DataGridTextColumn
                                            Binding="{Binding Path=Distance}"
                                            Header="Км">
                                    </DataGridTextColumn>
                                    <DataGridComboBoxColumn
                                            x:Name="WorksCustomerList2"
                                            DisplayMemberPath="Name"
                                            SelectedValuePath="Id"
                                            SelectedValueBinding="{Binding Path=Customer}"
                                            Header="Заказчик">
                                    </DataGridComboBoxColumn>
                                    <DataGridTextColumn
                                            Binding="{Binding Path=PriceOfSales}"
                                            Header="Сумма">
                                    </DataGridTextColumn>
                                    <DataGridComboBoxColumn
                                            x:Name="WorksCurrencySalesList2"
                                            DisplayMemberPath="ShortName"
                                            SelectedValuePath="Id"
                                            SelectedValueBinding="{Binding Path=CurrencySales}"
                                            Header="Валюта">
                                    </DataGridComboBoxColumn>
                                    <DataGridComboBoxColumn
                                            x:Name="WorksCustomerCommissionList2"
                                            DisplayMemberPath="Name"
                                            SelectedValuePath="Id"
                                            SelectedValueBinding="{Binding Path=CustomerCommission}"
                                            Header="КомиссионерЗаказч">
                                    </DataGridComboBoxColumn>
                                    <DataGridTextColumn
                                            Binding="{Binding Path=PriceCommissionSales}"
                                            Header="СуммаКомисЗаказч">
                                    </DataGridTextColumn>
                                    <DataGridComboBoxColumn
                                            x:Name="WorksProjectList2"
                                            DisplayMemberPath="Name"
                                            SelectedValuePath="Id"
                                            SelectedValueBinding="{Binding Path=Project}"
                                            Header="Проект">
                                    </DataGridComboBoxColumn>
                                    <DataGridTextColumn
                                            Binding="{Binding Path=Discription}"
                                            Header="Описание">
                                    </DataGridTextColumn>
                                </DataGrid.Columns>
                            </DataGrid>
                        </DockPanel>
                    </TabItem>
                    <TabItem Header="Продажа">
                        <DockPanel>
                            <Button DockPanel.Dock="Top" 
                            Click="WorksCloneButton_Click3">Клонирование записи - Продажа</Button>
                            <DataGrid Name="WorksDataGrid3"
                              Style="{StaticResource DataGridStyle}">
                                <DataGrid.Columns>
                                    <DataGridTemplateColumn Header="Дата">
                                        <DataGridTemplateColumn.CellTemplate>
                                            <DataTemplate>
                                                <TextBlock Text="{Binding Path= Date, StringFormat=\{0:d\}}" />
                                            </DataTemplate>
                                        </DataGridTemplateColumn.CellTemplate>
                                        <DataGridTemplateColumn.CellEditingTemplate>
                                            <DataTemplate>
                                                <DatePicker
                                            SelectedDate="{Binding Path=Date, Mode=TwoWay,ValidatesOnExceptions=true, NotifyOnValidationError=true}" />
                                            </DataTemplate>
                                        </DataGridTemplateColumn.CellEditingTemplate>
                                    </DataGridTemplateColumn>
                                    <DataGridComboBoxColumn
                                        x:Name="WorksOperTypeList3"
                                        DisplayMemberPath="Name"
                                        SelectedValuePath="Id"
                                        SelectedValueBinding="{Binding Path=OperType}"
                                        Header="ТипРаб">
                                    </DataGridComboBoxColumn>
                                    <DataGridComboBoxColumn
                                        x:Name="WorksGoodsList3"
                                        DisplayMemberPath="Name"
                                        SelectedValuePath="Id"
                                        SelectedValueBinding="{Binding Path=Goods}"
                                        Header="Груз">
                                    </DataGridComboBoxColumn>
                                    <DataGridTextColumn
                                        Binding="{Binding Path=WeightDownload}"
                                        Header="Вес загр">
                                    </DataGridTextColumn>
                                    <DataGridTextColumn
                                        Binding="{Binding Path=Weight}"
                                        Header="Вес разгр">
                                    </DataGridTextColumn>
                                    <DataGridComboBoxColumn
                                        x:Name="WorksSupplierList3"
                                        DisplayMemberPath="Name"
                                        SelectedValuePath="Id"
                                        SelectedValueBinding="{Binding Path=Supplier}"
                                        Header="Поставщик">
                                    </DataGridComboBoxColumn>
                                    <DataGridTextColumn
                                        Binding="{Binding Path=PriceOfPurchasing}"
                                        Header="СуммаЗакуп">
                                    </DataGridTextColumn>
                                    <DataGridComboBoxColumn
                                        x:Name="WorksCurrencyPurchasingList3"
                                        DisplayMemberPath="ShortName"
                                        SelectedValuePath="Id"
                                        SelectedValueBinding="{Binding Path=CurrencyPurchasing}"
                                        Header="ВалЗакуп">
                                    </DataGridComboBoxColumn>
                                    <DataGridComboBoxColumn
                                        x:Name="WorksSupplierCommissionList3"
                                        DisplayMemberPath="Name"
                                        SelectedValuePath="Id"
                                        SelectedValueBinding="{Binding Path=SupplierCommission}"
                                        Header="КомиссионерПоставщика">
                                    </DataGridComboBoxColumn>
                                    <DataGridTextColumn
                                        Binding="{Binding Path=PriceCommissionPurchase}"
                                        Header="СуммаКомисПоставщика">
                                    </DataGridTextColumn>
                                    <DataGridComboBoxColumn
                                        x:Name="WorksCustomerList3"
                                        DisplayMemberPath="Name"
                                        SelectedValuePath="Id"
                                        SelectedValueBinding="{Binding Path=Customer}"
                                        Header="Заказчик">
                                    </DataGridComboBoxColumn>
                                    <DataGridTextColumn
                                        Binding="{Binding Path=PriceOfSales}"
                                        Header="СуммаПрод">
                                    </DataGridTextColumn>
                                    <DataGridComboBoxColumn
                                        x:Name="WorksCurrencySalesList3"
                                        DisplayMemberPath="ShortName"
                                        SelectedValuePath="Id"
                                        SelectedValueBinding="{Binding Path=CurrencySales}"
                                        Header="ВалПродажи">
                                    </DataGridComboBoxColumn>
                                    <DataGridComboBoxColumn
                                        x:Name="WorksCustomerCommissionList3"
                                        DisplayMemberPath="Name"
                                        SelectedValuePath="Id"
                                        SelectedValueBinding="{Binding Path=CustomerCommission}"
                                        Header="КомиссионерЗаказч">
                                    </DataGridComboBoxColumn>
                                    <DataGridTextColumn
                                        Binding="{Binding Path=PriceCommissionSales}"
                                        Header="СуммаКомисЗаказч">
                                    </DataGridTextColumn>
                                    <DataGridComboBoxColumn
                                        x:Name="WorksProjectList3"
                                        DisplayMemberPath="Name"
                                        SelectedValuePath="Id"
                                        SelectedValueBinding="{Binding Path=Project}"
                                        Header="Проект">
                                    </DataGridComboBoxColumn>
                                    <DataGridTextColumn
                                        Binding="{Binding Path=Discription}"
                                        Header="Описание">
                                    </DataGridTextColumn>
                                </DataGrid.Columns>
                            </DataGrid>
                        </DockPanel>
                    </TabItem>
                    <TabItem Header="Услуги">
                        <DockPanel>
                                <DataGrid Name="WorksDataGrid4"
                                      Style="{StaticResource DataGridStyle}">
                                <DataGrid.Columns>
                                    <DataGridTemplateColumn Header="Дата">
                                        <DataGridTemplateColumn.CellTemplate>
                                            <DataTemplate>
                                                <TextBlock Text="{Binding Path= Date, StringFormat=\{0:d\}}" />
                                            </DataTemplate>
                                        </DataGridTemplateColumn.CellTemplate>
                                        <DataGridTemplateColumn.CellEditingTemplate>
                                            <DataTemplate>
                                                <DatePicker
                                                    SelectedDate="{Binding Path=Date, Mode=TwoWay,ValidatesOnExceptions=true, NotifyOnValidationError=true}" />
                                            </DataTemplate>
                                        </DataGridTemplateColumn.CellEditingTemplate>
                                    </DataGridTemplateColumn>
                                    <DataGridComboBoxColumn
                                            IsReadOnly="False"
                                            x:Name="WorksOperTypeList4"
                                            DisplayMemberPath="Name"
                                            SelectedValuePath="Id"
                                            SelectedValueBinding="{Binding Path=OperType}"
                                            Header="ТипРаб">
                                    </DataGridComboBoxColumn>
                                    <DataGridTextColumn
                                            IsReadOnly="False"
                                            Binding="{Binding Path=Discription}"
                                            Header="Описание услуги">
                                    </DataGridTextColumn>                                    
                                    <DataGridComboBoxColumn
                                            IsReadOnly="False"
                                            x:Name="WorksCustomerList4"
                                            DisplayMemberPath="Name"
                                            SelectedValuePath="Id"
                                            SelectedValueBinding="{Binding Path=Customer}"
                                            Header="Заказчик">
                                    </DataGridComboBoxColumn>
                                    <DataGridTextColumn
                                            Binding="{Binding Path=PriceOfSales}"
                                            Header="СуммаПродажи">
                                    </DataGridTextColumn>
                                    <DataGridComboBoxColumn
                                            x:Name="WorksCurrencySalesList4"
                                            DisplayMemberPath="ShortName"
                                            SelectedValuePath="Id"
                                            SelectedValueBinding="{Binding Path=CurrencySales}"
                                            Header="ВалПродажи">
                                    </DataGridComboBoxColumn>
                                    <DataGridComboBoxColumn
                                            x:Name="WorksCustomerCommissionList4"
                                            DisplayMemberPath="Name"
                                            SelectedValuePath="Id"
                                            SelectedValueBinding="{Binding Path=CustomerCommission}"
                                            Header="КомиссионерЗаказч">
                                    </DataGridComboBoxColumn>
                                    <DataGridTextColumn
                                            Binding="{Binding Path=PriceCommissionSales}"
                                            Header="СуммаКомисЗаказч">
                                    </DataGridTextColumn>
                                    <DataGridComboBoxColumn
                                            x:Name="WorksProjectList4"
                                            DisplayMemberPath="Name"
                                            SelectedValuePath="Id"
                                            SelectedValueBinding="{Binding Path=Project}"
                                            Header="Проект">
                                    </DataGridComboBoxColumn>
                                </DataGrid.Columns>
                            </DataGrid>
                        </DockPanel>
                    </TabItem>
                    <TabItem Header="Ремонтные дни">
                        <DockPanel>
                            <DataGrid Name="WorksDataGrid7"
                                      Style="{StaticResource DataGridStyle}">
                                <DataGrid.Columns>
                                    <DataGridTemplateColumn Header="Дата">
                                        <DataGridTemplateColumn.CellTemplate>
                                            <DataTemplate>
                                                <TextBlock Text="{Binding Path= Date, StringFormat=\{0:d\}}" />
                                            </DataTemplate>
                                        </DataGridTemplateColumn.CellTemplate>
                                        <DataGridTemplateColumn.CellEditingTemplate>
                                            <DataTemplate>
                                                <DatePicker
                                                    SelectedDate="{Binding Path=Date, Mode=TwoWay,ValidatesOnExceptions=true, NotifyOnValidationError=true}" />
                                            </DataTemplate>
                                        </DataGridTemplateColumn.CellEditingTemplate>
                                    </DataGridTemplateColumn>
                                    <DataGridComboBoxColumn
                                        IsReadOnly="False"
                                        x:Name="WorksOperTypeList7"
                                        DisplayMemberPath="Name"
                                        SelectedValuePath="Id"
                                        SelectedValueBinding="{Binding Path=OperType}"
                                        Header="ТипРаб">
                                    </DataGridComboBoxColumn>
                                    <DataGridComboBoxColumn
                                        x:Name="WorksDriverList7"
                                        DisplayMemberPath="Name"
                                        SelectedValuePath="Id"
                                        SelectedValueBinding="{Binding Path=Driver}"
                                        Header="Водитель">
                                    </DataGridComboBoxColumn>
                                    <DataGridTextColumn
                                        Binding="{Binding Path=SalaryDriver}"
                                        Header="ЗарплВод">
                                    </DataGridTextColumn>
                                    <DataGridComboBoxColumn
                                        x:Name="WorksProjectList7"
                                        DisplayMemberPath="Name"
                                        SelectedValuePath="Id"
                                        SelectedValueBinding="{Binding Path=Project}"
                                        Header="Проект">
                                    </DataGridComboBoxColumn>
                                    <DataGridTextColumn
                                        IsReadOnly="False"
                                        Binding="{Binding Path=Discription}"
                                        Header="Комментарий">
                                    </DataGridTextColumn>
                                </DataGrid.Columns>
                            </DataGrid>
                        </DockPanel>
                    </TabItem>
                    <TabItem Header="Техн. режим">
                        <DockPanel>
                            <!--<Button DockPanel.Dock="Top" 
                            Click="WorksCloneButton_Click">Клонирование записи - Продажи</Button>-->
                            <DataGrid Name="WorksDataGrid9"
                              Style="{StaticResource DataGridStyle}">
                                <DataGrid.Columns>
                                    <DataGridTemplateColumn Header="Дата">
                                        <DataGridTemplateColumn.CellTemplate>
                                            <DataTemplate>
                                                <TextBlock Text="{Binding Path= Date, StringFormat=\{0:d\}}" />
                                            </DataTemplate>
                                        </DataGridTemplateColumn.CellTemplate>
                                        <DataGridTemplateColumn.CellEditingTemplate>
                                            <DataTemplate>
                                                <DatePicker
                                            SelectedDate="{Binding Path=Date, Mode=TwoWay,ValidatesOnExceptions=true, NotifyOnValidationError=true}" />
                                            </DataTemplate>
                                        </DataGridTemplateColumn.CellEditingTemplate>
                                    </DataGridTemplateColumn>
                                    <DataGridComboBoxColumn
                                        x:Name="WorksOperTypeList9"
                                        DisplayMemberPath="Name"
                                        SelectedValuePath="Id"
                                        SelectedValueBinding="{Binding Path=OperType}"
                                        Header="ТипРаб">
                                    </DataGridComboBoxColumn>
                                    <DataGridComboBoxColumn
                                        x:Name="WorksLoadingPlaceList9"
                                        DisplayMemberPath="Name"
                                        SelectedValuePath="Id"
                                        SelectedValueBinding="{Binding Path=LoadingPlace}"
                                        Header="Место загрузки">
                                    </DataGridComboBoxColumn>
                                    <DataGridComboBoxColumn
                                        x:Name="WorksUnloadingPlaceList9"
                                        DisplayMemberPath="Name"
                                        SelectedValuePath="Id"
                                        SelectedValueBinding="{Binding Path=UnloadingPlace}"
                                        Header="Место разгрузки">
                                    </DataGridComboBoxColumn>
                                    <DataGridComboBoxColumn
                                        x:Name="WorksMachineList9"
                                        DisplayMemberPath="Name"
                                        SelectedValuePath="Id"
                                        SelectedValueBinding="{Binding Path=Machine}"
                                        Header="Машина">
                                    </DataGridComboBoxColumn>
                                    <DataGridComboBoxColumn
                                        x:Name="WorksDriverList9"
                                        DisplayMemberPath="Name"
                                        SelectedValuePath="Id"
                                        SelectedValueBinding="{Binding Path=Driver}"
                                        Header="Водитель">
                                    </DataGridComboBoxColumn>
                                    <DataGridTextColumn
                                        Binding="{Binding Path=SalaryDriver}"
                                        Header="ЗарплВод">
                                    </DataGridTextColumn>
                                    <DataGridComboBoxColumn
                                        x:Name="WorksGoodsList9"
                                        DisplayMemberPath="Name"
                                        SelectedValuePath="Id"
                                        SelectedValueBinding="{Binding Path=Goods}"
                                        Header="Груз">
                                    </DataGridComboBoxColumn>
                                    <DataGridTextColumn
                                        Binding="{Binding Path=WeightDownload}"
                                        Header="Вес загр">
                                    </DataGridTextColumn>
                                    <DataGridTextColumn
                                        Binding="{Binding Path=Weight}"
                                        Header="Вес разгр">
                                    </DataGridTextColumn>
                                    <DataGridTextColumn
                                        Binding="{Binding Path=Distance}"
                                        Header="Км">
                                    </DataGridTextColumn>
                                    <DataGridTextColumn
                                        IsReadOnly="True"
                                        Binding="{Binding Path=CountWork}"
                                        Header="КолРаб">
                                    </DataGridTextColumn>
                                    <DataGridComboBoxColumn
                                        x:Name="WorksSupplierList9"
                                        DisplayMemberPath="Name"
                                        SelectedValuePath="Id"
                                        SelectedValueBinding="{Binding Path=Supplier}"
                                        Header="Поставщик">
                                    </DataGridComboBoxColumn>
                                    <DataGridTextColumn
                                        Binding="{Binding Path=PriceOfPurchasing}"
                                        Header="СуммаЗакуп">
                                    </DataGridTextColumn>
                                    <DataGridComboBoxColumn
                                        x:Name="WorksCurrencyPurchasingList9"
                                        DisplayMemberPath="ShortName"
                                        SelectedValuePath="Id"
                                        SelectedValueBinding="{Binding Path=CurrencyPurchasing}"
                                        Header="ВалЗакуп">
                                    </DataGridComboBoxColumn>
                                    <DataGridComboBoxColumn
                                        x:Name="WorksSupplierCommissionList9"
                                        DisplayMemberPath="Name"
                                        SelectedValuePath="Id"
                                        SelectedValueBinding="{Binding Path=SupplierCommission}"
                                        Header="КомиссионерПоставщика">
                                    </DataGridComboBoxColumn>
                                    <DataGridTextColumn
                                        Binding="{Binding Path=PriceCommissionPurchase}"
                                        Header="СуммаКомисПоставщика">
                                    </DataGridTextColumn>
                                    <DataGridComboBoxColumn
                                        x:Name="WorksCustomerList9"
                                        DisplayMemberPath="Name"
                                        SelectedValuePath="Id"
                                        SelectedValueBinding="{Binding Path=Customer}"
                                        Header="Заказчик">
                                    </DataGridComboBoxColumn>
                                    <DataGridTextColumn
                                        Binding="{Binding Path=PriceOfSales}"
                                        Header="СуммаПрод">
                                    </DataGridTextColumn>
                                    <DataGridComboBoxColumn
                                        x:Name="WorksCurrencySalesList9"
                                        DisplayMemberPath="ShortName"
                                        SelectedValuePath="Id"
                                        SelectedValueBinding="{Binding Path=CurrencySales}"
                                        Header="ВалПродажи">
                                    </DataGridComboBoxColumn>
                                    <DataGridComboBoxColumn
                                        x:Name="WorksCustomerCommissionList9"
                                        DisplayMemberPath="Name"
                                        SelectedValuePath="Id"
                                        SelectedValueBinding="{Binding Path=CustomerCommission}"
                                        Header="КомиссионерЗаказч">
                                    </DataGridComboBoxColumn>
                                    <DataGridTextColumn
                                        Binding="{Binding Path=PriceCommissionSales}"
                                        Header="СуммаКомисЗаказч">
                                    </DataGridTextColumn>
                                    <DataGridComboBoxColumn
                                        x:Name="WorksProjectList9"
                                        DisplayMemberPath="Name"
                                        SelectedValuePath="Id"
                                        SelectedValueBinding="{Binding Path=Project}"
                                        Header="Проект">
                                    </DataGridComboBoxColumn>
                                    <DataGridTextColumn
                                        Binding="{Binding Path=Discription}"
                                        Header="Описание">
                                    </DataGridTextColumn>
                                </DataGrid.Columns>
                            </DataGrid>
                        </DockPanel>
                    </TabItem>
                </TabControl>
            </TabItem>
            <TabItem Header="Финансы">
                <DataGrid Name="TransactionsDataGrid"
                          Style="{StaticResource DataGridStyle}">
                    <DataGrid.Columns>
                        <DataGridTemplateColumn Header="Дата">
                            <DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <TextBlock Text="{Binding Path= Date, StringFormat=\{0:d\}}" />
                                </DataTemplate>
                            </DataGridTemplateColumn.CellTemplate>
                            <DataGridTemplateColumn.CellEditingTemplate>
                                <DataTemplate>
                                    <DatePicker
                                        SelectedDate="{Binding Path=Date, Mode=TwoWay, ValidatesOnExceptions=true, NotifyOnValidationError=true}" />
                                </DataTemplate>
                            </DataGridTemplateColumn.CellEditingTemplate>
                        </DataGridTemplateColumn>
                        <DataGridComboBoxColumn
                                        x:Name="TransactionsTypeList"
                                        DisplayMemberPath="Name"
                                        SelectedValuePath="Id"
                                        SelectedValueBinding="{Binding Path=Type}"
                                        Header="Тип транзакции">
                        </DataGridComboBoxColumn>
                        <DataGridTextColumn
                                        Binding="{Binding Path=Summa}"
                                        Header="Сумма">
                        </DataGridTextColumn>
                        <DataGridComboBoxColumn
                                        x:Name="TransactionsCurrencyList"
                                        DisplayMemberPath="ShortName"
                                        SelectedValuePath="Id"
                                        SelectedValueBinding="{Binding Path=Currency}"
                                        Header="Валюта">
                        </DataGridComboBoxColumn>
                        <DataGridComboBoxColumn
                                        x:Name="TransactionsCategoryList"
                                        DisplayMemberPath="Name"
                                        SelectedValuePath="Id"
                                        SelectedValueBinding="{Binding Path=Category}"
                                        Header="Категория">
                        </DataGridComboBoxColumn>
                        <DataGridComboBoxColumn
                                        x:Name="TransactionsPartnerList"
                                        DisplayMemberPath="Name"
                                        SelectedValuePath="Id"
                                        SelectedValueBinding="{Binding Path=Partner}"
                                        Header="Партнер">
                        </DataGridComboBoxColumn>
                        <DataGridComboBoxColumn
                                        x:Name="TransactionsProjectList"
                                        DisplayMemberPath="Name"
                                        SelectedValuePath="Id"
                                        SelectedValueBinding="{Binding Path=Project}"
                                        Header="Проект">
                        </DataGridComboBoxColumn>
                        <DataGridComboBoxColumn
                                        x:Name="TransactionsDriverList"
                                        DisplayMemberPath="Name"
                                        SelectedValuePath="Id"
                                        SelectedValueBinding="{Binding Path=Driver}"
                                        Header="Сотрудник">
                        </DataGridComboBoxColumn>
                        <DataGridTextColumn
                                    Binding="{Binding Path=Liters}"
                                    Header="Литры">
                        </DataGridTextColumn>
                        <DataGridTextColumn
                                        Binding="{Binding Path=Discription}"
                                        Header="Описание">
                        </DataGridTextColumn>
                    </DataGrid.Columns>
                </DataGrid>
            </TabItem>
            <TabItem Header="Учет топлива">
                <TabControl>
                    <TabItem Header="Заправка машин">
                        <DataGrid Name="RefuelingDataGrid2"
                          Style="{StaticResource DataGridStyle}">
                            
                            <DataGrid.Columns>
                                
                                <!--<DataGridTemplateColumn Header="Дата">
                                    <DataGridTemplateColumn.CellTemplate>
                                        <DataTemplate>
                                            <TextBlock Text="{Binding Path= Date, StringFormat=\{0:dd.MM.yy HH:mm\}}" />
                                        </DataTemplate>
                                    </DataGridTemplateColumn.CellTemplate>
                                    <DataGridTemplateColumn.CellEditingTemplate>
                                        <DataTemplate>
                                            <DatePicker SelectedDate="{Binding Path=Date, Mode=TwoWay, ValidatesOnExceptions=true, NotifyOnValidationError=true}" />
                                        </DataTemplate>
                                    </DataGridTemplateColumn.CellEditingTemplate>
                                </DataGridTemplateColumn>-->
                                
                                <DataGridTemplateColumn Header="ДатаВремя">
                                    
                                    <DataGridTemplateColumn.CellTemplate>
                                        <DataTemplate>
                                            <TextBlock Text="{Binding Path= Date, StringFormat=\{0:dd.MM.yy HH:mm\}}" />
                                        </DataTemplate>
                                    </DataGridTemplateColumn.CellTemplate>
                                    
                                    <DataGridTemplateColumn.CellEditingTemplate>
                                        <DataTemplate>
                                            <xctk:DateTimePicker x:Name="dtpStartTime"  
                                                 Value="{Binding Path= Date}"
                                                 Format="Custom" 
                                                 FormatString="dd.MM.yy HH:mm" 
                                                 />
                                        </DataTemplate>
                                    </DataGridTemplateColumn.CellEditingTemplate>
                                    
                                </DataGridTemplateColumn>

                                <DataGridComboBoxColumn
                                    x:Name="RefuelingFuelOperTypeList2"
                                    DisplayMemberPath="Name"
                                    SelectedValuePath="Id"
                                    SelectedValueBinding="{Binding Path=FuelOperType}"
                                    Header="ВидЗаправки">
                                </DataGridComboBoxColumn>
                                <DataGridComboBoxColumn
                                    x:Name="RefuelingFuelSupplierList2"
                                    DisplayMemberPath="Name"
                                    SelectedValuePath="Id"
                                    SelectedValueBinding="{Binding Path=FuelSupplier}"
                                    Header="Поставщик топлива">
                                </DataGridComboBoxColumn>
                                <DataGridComboBoxColumn
                                    x:Name="RefuelingFuelTypeList2"
                                    DisplayMemberPath="Name"
                                    SelectedValuePath="Id"
                                    SelectedValueBinding="{Binding Path=FuelType}"
                                    Header="Топливо">
                                </DataGridComboBoxColumn>
                                <DataGridComboBoxColumn
                                    x:Name="RefuelingsMachineList2"
                                    DisplayMemberPath="Name"
                                    SelectedValuePath="Id"
                                    SelectedValueBinding="{Binding Path=Machine}"
                                    Header="Машина">
                                </DataGridComboBoxColumn>
                                <DataGridComboBoxColumn
                                    x:Name="RefuelingDriverList2"
                                    DisplayMemberPath="Name"
                                    SelectedValuePath="Id"
                                    SelectedValueBinding="{Binding Path=Driver}"
                                    Header="Водитель">
                                </DataGridComboBoxColumn>
                                <DataGridTextColumn
                                    Binding="{Binding Path=Liters}"
                                    Header="Кол-во литров">
                                </DataGridTextColumn>
                                <DataGridTextColumn
                                    Binding="{Binding Path=Price}"
                                    Header="Стоимость (грн)">
                                </DataGridTextColumn>
                                <DataGridTextColumn
                                    Binding="{Binding Path=FuelRemaining}"
                                    Header="Остаток в баке (л)">
                                </DataGridTextColumn>
                                <DataGridTextColumn
                                    Binding="{Binding Path=Distance}"
                                    Header="Пробег по GPS (км)">
                                </DataGridTextColumn>
                                <DataGridTextColumn
                                    Binding="{Binding Path=Odometer}"
                                    Header="Показатель одометра (км)">
                                </DataGridTextColumn>
                                <DataGridComboBoxColumn
                                        x:Name="RefuelingsProjectList2"
                                        DisplayMemberPath="Name"
                                        SelectedValuePath="Id"
                                        SelectedValueBinding="{Binding Path=Project}"
                                        Header="Проект">
                                </DataGridComboBoxColumn>
                                <DataGridTextColumn
                                        Binding="{Binding Path=Discription}"
                                        Header="Комментарий">
                                </DataGridTextColumn>
                            </DataGrid.Columns>
                        </DataGrid>
                    </TabItem>
                    <TabItem Header="Отчеты и статистика">
                        <TabControl>
                            <TabItem Header="Расчеты с поставщиками топлива">
                                <DataGrid Name="FuelSupplier"
                                  IsEnabled="True"
                                  IsReadOnly="True" />
                            </TabItem>
                            <TabItem Header="Расход топлива (всего)">
                                <DataGrid Name="FuelMachinas2"
                                  IsEnabled="True"
                                  IsReadOnly="True" />
                            </TabItem>
                            <TabItem Header="Расход топлива (месяц)">
                                <DataGrid Name="FuelMachinas2_month"
                                  IsEnabled="True"
                                  IsReadOnly="True" />
                            </TabItem>
                            <TabItem Header="Мониторинг">
                                <DataGrid Name="FuelMonitoring"
                                  IsEnabled="True"
                                  IsReadOnly="True" />
                            </TabItem>
                        </TabControl>
                    </TabItem>
                    <TabItem Header="Своя АЗС">
                        <TabControl>
                            <TabItem Header="Заправка машин">
                                <DataGrid Name="RefuelingDataGrid"
                          Style="{StaticResource DataGridStyle}">
                                    <DataGrid.Columns>
                                        <DataGridTemplateColumn Header="Дата">
                                            <DataGridTemplateColumn.CellTemplate>
                                                <DataTemplate>
                                                    <TextBlock Text="{Binding Path= Date, StringFormat=\{0:d\}}" />
                                                </DataTemplate>
                                            </DataGridTemplateColumn.CellTemplate>
                                            <DataGridTemplateColumn.CellEditingTemplate>
                                                <DataTemplate>
                                                    <DatePicker
                                        SelectedDate="{Binding Path=Date, Mode=TwoWay, ValidatesOnExceptions=true, NotifyOnValidationError=true}" />
                                                </DataTemplate>
                                            </DataGridTemplateColumn.CellEditingTemplate>
                                        </DataGridTemplateColumn>
                                        <DataGridComboBoxColumn
                                            x:Name="RefuelingFuelOperTypeList"
                                            DisplayMemberPath="Name"
                                            SelectedValuePath="Id"
                                            SelectedValueBinding="{Binding Path=FuelOperType}"
                                            Header="ВидЗаправки">
                                        </DataGridComboBoxColumn>
                                        <DataGridComboBoxColumn
                                            x:Name="RefuelingGasSattionsList"
                                            DisplayMemberPath="Name"
                                            SelectedValuePath="Id"
                                            SelectedValueBinding="{Binding Path=GasStation}"
                                            Header="АЗС">
                                        </DataGridComboBoxColumn>
                                        <DataGridComboBoxColumn
                                            x:Name="RefuelingsMachineList"
                                            DisplayMemberPath="Name"
                                            SelectedValuePath="Id"
                                            SelectedValueBinding="{Binding Path=Machine}"
                                            Header="Машина">
                                        </DataGridComboBoxColumn>
                                        <DataGridComboBoxColumn
                                            x:Name="RefuelingDriverList"
                                            DisplayMemberPath="Name"
                                            SelectedValuePath="Id"
                                            SelectedValueBinding="{Binding Path=Driver}"
                                            Header="Водитель">
                                        </DataGridComboBoxColumn>
                                        <DataGridComboBoxColumn
                                            x:Name="RefuelingsFuelList"
                                            DisplayMemberPath="Name"
                                            SelectedValuePath="Id"
                                            SelectedValueBinding="{Binding Path=Fuel}"
                                            Header="Топливо">
                                        </DataGridComboBoxColumn>
                                        <DataGridTextColumn
                                           Binding="{Binding Path=Liters}"
                                            Header="Кол-во литров">
                                        </DataGridTextColumn>
                                        <DataGridTextColumn
                                            Binding="{Binding Path=FuelRemaining}"
                                            Header="Остаток в баке (л)">
                                        </DataGridTextColumn>
                                        <DataGridTextColumn
                                            Binding="{Binding Path=Distance}"
                                            Header="Пробег по GPS (км)">
                                        </DataGridTextColumn>
                                        <DataGridTextColumn
                                            Binding="{Binding Path=Odometer}"
                                            Header="Показатель одометра (км)">
                                        </DataGridTextColumn>
                                        <DataGridComboBoxColumn
                                            x:Name="RefuelingsProjectList"
                                            DisplayMemberPath="Name"
                                            SelectedValuePath="Id"
                                            SelectedValueBinding="{Binding Path=Project}"
                                            Header="Проект">
                                        </DataGridComboBoxColumn>
                                        <DataGridTextColumn
                                            Binding="{Binding Path=Discription}"
                                            Header="Комментарий">
                                        </DataGridTextColumn>
                                    </DataGrid.Columns>
                                </DataGrid>
                            </TabItem>
                            <TabItem Header="Отчеты">
                                <TabControl>
                                    <TabItem Header="Общий остаток">
                                        <DataGrid Name="FuelTotal"
                                  IsEnabled="True"
                                  IsReadOnly="True" />
                                    </TabItem>
                                    <TabItem Header="Расход по машинам">
                                        <DataGrid Name="FuelMachinas"
                                  IsEnabled="True"
                                  IsReadOnly="True" />
                                    </TabItem>
                                    <TabItem Header="Остаток по проектам">
                                        <DataGrid Name="FuelProjects"
                                  IsEnabled="True"
                                  IsReadOnly="True" />
                                    </TabItem>
                                    <TabItem Header="Расход по заправкам">
                                        <DataGrid Name="FuelGasStations"
                                  IsEnabled="True"
                                  IsReadOnly="True" />
                                    </TabItem>
                                </TabControl>
                            </TabItem>
                        </TabControl>
                    </TabItem>
                </TabControl>
            </TabItem>
        
            <TabItem Header="Справочники">
                <TabControl>
                    <TabItem Header="Категории">
                        <DataGrid ItemsSource="{Binding Path=DictionaryCategories}"
                                  Style="{StaticResource DataGridStyle}">
                            <DataGrid.Columns>
                                <DataGridTextColumn
                                    Binding="{Binding Path=Id}"
                                    Header="Id"
                                    IsReadOnly="True">
                                </DataGridTextColumn>
                                <DataGridTextColumn
                                    Binding="{Binding Path=Name}"
                                    Header="Name">
                                </DataGridTextColumn>
                                <DataGridComboBoxColumn
                                        x:Name="DictionaryCategoriesTypeList"
                                        DisplayMemberPath="Name"
                                        SelectedValuePath="Id"
                                        SelectedValueBinding="{Binding Path=Type}"
                                        Header="Type">
                                </DataGridComboBoxColumn>
                                <DataGridCheckBoxColumn
                                    Binding="{Binding Path=View}"
                                    Header="View">
                                </DataGridCheckBoxColumn>
                                <DataGridCheckBoxColumn
                                    Binding="{Binding Path=Fuel}"
                                    Header="Закупка топлива на свою АЗС">
                                </DataGridCheckBoxColumn>
                                <DataGridCheckBoxColumn
                                    Binding="{Binding Path=Fuel2}"
                                    Header="Закупка топлива у поставщика">
                                </DataGridCheckBoxColumn>
                            </DataGrid.Columns>
                        </DataGrid>
                    </TabItem>
                    <TabItem Header="Счета/Валюты">
                        <DataGrid ItemsSource="{Binding Path=DictionaryCurrencies}"
                                  Style="{StaticResource DataGridStyle}">
                            <DataGrid.Columns>
                                <DataGridTextColumn
                                    Binding="{Binding Path=Id}"
                                    Header="Id"
                                    IsReadOnly="True">
                                </DataGridTextColumn>
                                <DataGridTextColumn
                                    Binding="{Binding Path=Name}"
                                    Header="Name">
                                </DataGridTextColumn>
                                <DataGridTextColumn
                                    Binding="{Binding Path=ShortName}"
                                    Header="ShortName">
                                </DataGridTextColumn>
                                <DataGridCheckBoxColumn
                                    Binding="{Binding Path=View}"
                                    Header="View">
                                </DataGridCheckBoxColumn>
                            </DataGrid.Columns>
                        </DataGrid>
                    </TabItem>
                    <TabItem Header="Сотрудники">
                        <DataGrid ItemsSource="{Binding Path=DictionaryDrivers}"
                                  Style="{StaticResource DataGridStyle}">
                            <DataGrid.Columns>
                                <DataGridTextColumn
                                    Binding="{Binding Path=Id}"
                                    Header="Id"
                                    IsReadOnly="True">
                                </DataGridTextColumn>
                                <DataGridTextColumn
                                    Binding="{Binding Path=Name}"
                                    Header="Name">
                                </DataGridTextColumn>
                                <DataGridTextColumn
                                    Binding="{Binding Path=Phone}"
                                    Header="Phone">
                                </DataGridTextColumn>
                                <DataGridTextColumn
                                    Binding="{Binding Path=Discription}"
                                    Header="Discription">
                                </DataGridTextColumn>
                                <DataGridCheckBoxColumn
                                    Binding="{Binding Path=View}"
                                    Header="View">
                                </DataGridCheckBoxColumn>
                            </DataGrid.Columns>
                        </DataGrid>
                    </TabItem>
                    <TabItem Header="Грузы">
                        <DataGrid ItemsSource="{Binding Path=DictionaryGoods}"
                                  Style="{StaticResource DataGridStyle}">
                            <DataGrid.Columns>
                                <DataGridTextColumn
                                    Binding="{Binding Path=Id}"
                                    Header="Id"
                                    IsReadOnly="True">
                                </DataGridTextColumn>
                                <DataGridTextColumn
                                    Binding="{Binding Path=Name}"
                                    Header="Name">
                                </DataGridTextColumn>
                                <DataGridCheckBoxColumn
                                    Binding="{Binding Path=View}"
                                    Header="View">
                                </DataGridCheckBoxColumn>
                            </DataGrid.Columns>
                        </DataGrid>
                    </TabItem>
                    <TabItem Header="Машины">
                        <DataGrid ItemsSource="{Binding Path=DictionaryMachines}"
                                  Style="{StaticResource DataGridStyle}">
                            <DataGrid.Columns>
                                <DataGridTextColumn
                                    Binding="{Binding Path=Id}"
                                    Header="Id"
                                    IsReadOnly="True">
                                </DataGridTextColumn>
                                <DataGridTextColumn
                                    Binding="{Binding Path=Name}"
                                    Header="Name">
                                </DataGridTextColumn>
                                <DataGridCheckBoxColumn
                                    Binding="{Binding Path=View}"
                                    Header="View">
                                </DataGridCheckBoxColumn>
                            </DataGrid.Columns>
                        </DataGrid>
                    </TabItem>
                    <TabItem Header="Партнеры">
                        <DataGrid ItemsSource="{Binding Path=DictionaryPartners}"
                                  Style="{StaticResource DataGridStyle}">
                            <DataGrid.Columns>
                                <DataGridTextColumn
                                    Binding="{Binding Path=Id}"
                                    Header="Id"
                                    IsReadOnly="True">
                                </DataGridTextColumn>
                                <DataGridTextColumn
                                    Binding="{Binding Path=Name}"
                                    Header="Name">
                                </DataGridTextColumn>
                                <DataGridTextColumn
                                    Binding="{Binding Path=Phone}"
                                    Header="Phone">
                                </DataGridTextColumn>
                                <DataGridTextColumn
                                    Binding="{Binding Path=Email}"
                                    Header="Email">
                                </DataGridTextColumn>
                                <DataGridTextColumn
                                    Binding="{Binding Path=Discription}"
                                    Header="Discription">
                                </DataGridTextColumn>
                                <DataGridCheckBoxColumn
                                    Binding="{Binding Path=View}"
                                    Header="Все роли">
                                </DataGridCheckBoxColumn>
                                <DataGridCheckBoxColumn
                                    Binding="{Binding Path=Supplier}"
                                    Header="Поставщик">
                                </DataGridCheckBoxColumn>
                                <DataGridCheckBoxColumn
                                    Binding="{Binding Path=SupplierCommission}"
                                    Header="Комиссионер поставщика">
                                </DataGridCheckBoxColumn>
                                <DataGridCheckBoxColumn
                                    Binding="{Binding Path=Customer}"
                                    Header="Заказчик">
                                </DataGridCheckBoxColumn>
                                <DataGridCheckBoxColumn
                                    Binding="{Binding Path=CustomerCommission}"
                                    Header="Комиссионер заказчика">
                                </DataGridCheckBoxColumn>
                                <DataGridCheckBoxColumn
                                    Binding="{Binding Path=FinPartner}"
                                    Header="Контрагент (фин)">
                                </DataGridCheckBoxColumn>
                            <DataGridCheckBoxColumn
                                    Binding="{Binding Path=FuelSupplier}"
                                    Header="Поставщик топлива">
                            </DataGridCheckBoxColumn>
                        </DataGrid.Columns>
                        </DataGrid>
                    </TabItem>
                    <TabItem Header="Пункты">
                        <DataGrid ItemsSource="{Binding Path=DictionaryPlaces}"
                                  Style="{StaticResource DataGridStyle}">
                            <DataGrid.Columns>
                                <DataGridTextColumn
                                    Binding="{Binding Path=Id}"
                                    Header="Id"
                                    IsReadOnly="True">
                                </DataGridTextColumn>
                                <DataGridTextColumn
                                    Binding="{Binding Path=Name}"
                                    Header="Name">
                                </DataGridTextColumn>
                                <DataGridCheckBoxColumn
                                    Binding="{Binding Path=View}"
                                    Header="View">
                                </DataGridCheckBoxColumn>
                                <DataGridCheckBoxColumn
                                    Binding="{Binding Path=Store}"
                                    Header="Склад">
                                </DataGridCheckBoxColumn>
                            </DataGrid.Columns>
                        </DataGrid>
                    </TabItem>
                    <TabItem Header="Виды топлива">
                        <DataGrid ItemsSource="{Binding Path=DictionaryFuelTypes}"
                                  Style="{StaticResource DataGridStyle}">
                            <DataGrid.Columns>
                                <DataGridTextColumn
                                    Binding="{Binding Path=Id}"
                                    Header="Id"
                                    IsReadOnly="True">
                                </DataGridTextColumn>
                                <DataGridTextColumn
                                    Binding="{Binding Path=Name}"
                                    Header="Name">
                                </DataGridTextColumn>
                                <DataGridCheckBoxColumn
                                    Binding="{Binding Path=View}"
                                    Header="View">
                                </DataGridCheckBoxColumn>
                            </DataGrid.Columns>
                        </DataGrid>
                    </TabItem>
                    <TabItem Header="АЗС/Карты">
                        <DataGrid ItemsSource="{Binding Path=DictionaryGasStations}"
                                  Style="{StaticResource DataGridStyle}">
                            <DataGrid.Columns>
                                <DataGridTextColumn
                                    Binding="{Binding Path=Id}"
                                    Header="Id"
                                    IsReadOnly="True">
                                </DataGridTextColumn>
                                <DataGridTextColumn
                                    Binding="{Binding Path=Name}"
                                    Header="Name">
                                </DataGridTextColumn>
                                <DataGridCheckBoxColumn
                                    Binding="{Binding Path=View}"
                                    Header="View">
                                </DataGridCheckBoxColumn>
                            </DataGrid.Columns>
                        </DataGrid>
                    </TabItem>
                    <TabItem Header="Проекты">
                        <DataGrid ItemsSource="{Binding Path=DictionaryProjects}"
                                  Style="{StaticResource DataGridStyle}">
                            <DataGrid.Columns>
                                <DataGridTextColumn
                                    Binding="{Binding Path=Id}"
                                    Header="Id"
                                    IsReadOnly="True">
                                </DataGridTextColumn>
                                <DataGridTextColumn
                                    Binding="{Binding Path=Name}"
                                    Header="Name">
                                </DataGridTextColumn>
                                <DataGridCheckBoxColumn
                                    Binding="{Binding Path=View}"
                                    Header="View">
                                </DataGridCheckBoxColumn>
                            </DataGrid.Columns>
                        </DataGrid>
                    </TabItem>
                    <TabItem Header="Типы танзакций">
                        <DataGrid ItemsSource="{Binding Path=DictionaryTransactionTypes}"
                                  Style="{StaticResource DataGridStyle}">
                            <DataGrid.Columns>
                                <DataGridTextColumn
                                    Binding="{Binding Path=Id}"
                                    Header="Id" 
                                    IsReadOnly="True">
                                </DataGridTextColumn>
                                <DataGridTextColumn
                                    Binding="{Binding Path=Name}"
                                    Header="Name"
                                    IsReadOnly="True">
                                </DataGridTextColumn>
                            </DataGrid.Columns>
                        </DataGrid>
                    </TabItem>
                    <TabItem Header="Типы работ">
                        <DataGrid ItemsSource="{Binding Path=DictionaryOperTypes}"
                                  Style="{StaticResource DataGridStyle}">
                            <DataGrid.Columns>
                                <DataGridTextColumn
                                    Binding="{Binding Path=Id}"
                                    Header="Id" 
                                    IsReadOnly="True">
                                </DataGridTextColumn>
                                <DataGridTextColumn
                                    Binding="{Binding Path=Name}"
                                    Header="Name"
                                    IsReadOnly="True">
                                </DataGridTextColumn>
                            </DataGrid.Columns>
                        </DataGrid>
                    </TabItem>
                    <TabItem Header="Виды заправок">
                    <DataGrid ItemsSource="{Binding Path=DictionaryFuelOperTypes}"
                                  Style="{StaticResource DataGridStyle}">
                        <DataGrid.Columns>
                            <DataGridTextColumn
                                    Binding="{Binding Path=Id}"
                                    Header="Id" 
                                    IsReadOnly="True">
                            </DataGridTextColumn>
                            <DataGridTextColumn
                                    Binding="{Binding Path=Name}"
                                    Header="Name"
                                    IsReadOnly="True">
                            </DataGridTextColumn>
                        </DataGrid.Columns>
                    </DataGrid>
                </TabItem>
                </TabControl>
            </TabItem>
            <TabItem Header="Настройки">
                <TabControl>
                    <TabItem Header="Версия БД">
                        <DataGrid Name="VersionDBDataGrid"
                                  Style="{StaticResource DataGridStyle}"
                                  AutoGenerateColumns="True" IsReadOnly="True">
                        </DataGrid>
                    </TabItem>
                    <TabItem Header="Настройки">
                        <DataGrid ItemsSource="{Binding Path=Settings}"
                                  Style="{StaticResource DataGridStyle}">
                            <DataGrid.Columns>
                                <DataGridTextColumn
                                    Binding="{Binding Path=Id}"
                                    Header="Id"
                                    IsReadOnly="True">
                                </DataGridTextColumn>
                                <DataGridTextColumn
                                    Binding="{Binding Path=Code}"
                                    Header="Код">
                                </DataGridTextColumn>
                                <DataGridTextColumn
                                    Binding="{Binding Path=Value}"
                                    Header="Значение">
                                </DataGridTextColumn>
                                <DataGridTextColumn
                                    Binding="{Binding Path=Discription}"
                                    Header="Описание">
                                </DataGridTextColumn>
                            </DataGrid.Columns>
                        </DataGrid>
                    </TabItem>
                    <TabItem Header="Ошибки">
                        <DataGrid Name="ReportError"
                                  IsEnabled="True"
                                  IsReadOnly="True"/>
                    </TabItem>
                </TabControl>
            </TabItem>
            <TabItem Header="Отчеты">
                <TabControl>
                    <TabItem Header="Касса">
                        <DataGrid Name="Kassa"
                                  IsEnabled="True"
                                  IsReadOnly="True" />
                    </TabItem>
                    <TabItem Header="Расчеты с партнерами">
                        <TabControl>
                            <TabItem Header="Дебиторская задолж NEW (мне должны)">
                                <DataGrid Name="ReceivablesNew"
                                        IsEnabled="True"
                                        IsReadOnly="True" />
                            </TabItem>
                            <TabItem Header="Кредиторская задолж NEW (я должен)">
                                <DataGrid Name="PayablesNew"
                                        IsEnabled="True"
                                        IsReadOnly="True" />
                            </TabItem>
                            <TabItem Header="Учет комиссий NEW">
                                <DataGrid Name="ReportComission"
                                  IsEnabled="True"
                                  IsReadOnly="True" />
                            </TabItem>
                        </TabControl>
                    </TabItem>
                    <TabItem Header="Зарплата сотрудников">
                        <DataGrid Name="ReportZPVoditel"
                                  IsEnabled="True"
                                  IsReadOnly="True" />
                    </TabItem>
                    <TabItem Header="Финансовые отчеты">
                        <TabControl>
                            <TabItem Header="Суммы по категориям">
                            <DataGrid Name="ReportCategories"
                                  IsEnabled="True"
                                  IsReadOnly="True" />
                        </TabItem>
                            <TabItem Header="Фин Долги и Кредиты">
                            <DataGrid Name="ReportDolg"
                                  IsEnabled="True"
                                  IsReadOnly="True" />
                        </TabItem>
                            <TabItem Header="Анализ продаж">
                            <DataGrid Name="ReportProcent"
                                        IsEnabled="True"
                                        IsReadOnly="True" />
                        </TabItem>
                        </TabControl>
                    </TabItem>
                    <TabItem Header="Склад">
                        <DataGrid Name="Store"
                                  IsEnabled="True"
                                  IsReadOnly="True" />
                    </TabItem>
                    <TabItem Header="Старые отчеты">
                        <TabControl>
                            <TabItem Header="Дебиторская задол-ть (заказчики)">
                                <DataGrid Name="Receivables"
                                        IsEnabled="True"
                                        IsReadOnly="True" />
                            </TabItem>
                            <TabItem Header="Кредиторская задол-ть (поставщики)">
                                <DataGrid Name="Payables"
                                        IsEnabled="True"
                                        IsReadOnly="True" />
                            </TabItem>
                            <TabItem Header="Налоги СПД">
                                <DataGrid Name="ReportNalog"
                                  IsEnabled="True"
                                  IsReadOnly="True" />
                            </TabItem>
                        </TabControl>
                    </TabItem>
                </TabControl>
            </TabItem>
            <TabItem Header="Конструктор"
                     IsEnabled="True">
                <dx:DXTabControl>
                    <dx:DXTabItem Header="Отчет (работы)">
                        <Grid>
                            <dxg:GridControl Name="WorksRep" AutoPopulateColumns="True">
                                <dxg:GridControl.View>
                                    <dxg:TableView AutoWidth="True" 
                                                   ShowFilterPanelMode="ShowAlways"
                                                   ShowAutoFilterRow="True"
                                                   ShowTotalSummary="True"
                                                   ShowGroupedColumns="True"
                                                   IsEnabled="True"
                                                   AllowEditing="False"
                                                   AllowDrop="False"
                                                   AllowFixedColumnMenu="True" />
                                </dxg:GridControl.View>
                            </dxg:GridControl>
                        </Grid>
                    </dx:DXTabItem>
                    <!--<dx:DXTabItem Header="Отчет (работы New)">
                        <Grid>
                            <dxg:GridControl Name="WorksRepNew" AutoPopulateColumns="True">
                                <dxg:GridControl.View>
                                    <dxg:TableView AutoWidth="True" 
                                                   ShowFilterPanelMode="ShowAlways"
                                                   ShowAutoFilterRow="True"
                                                   ShowTotalSummary="True"
                                                   ShowGroupedColumns="True"
                                                   IsEnabled="True"
                                                   AllowEditing="False"
                                                   AllowDrop="False"
                                                   AllowFixedColumnMenu="True" />
                                </dxg:GridControl.View>
                            </dxg:GridControl>
                        </Grid>
                    </dx:DXTabItem>-->
                    <dx:DXTabItem Header="Отчет (финансы)">
                        <Grid>
                            <dxg:GridControl Name="FinRep" AutoPopulateColumns="True">
                                <dxg:GridControl.View>
                                    <dxg:TableView 
                                                AutoWidth="True" 
                                                ShowFilterPanelMode="ShowAlways"
                                                ShowAutoFilterRow="True"
                                                ShowTotalSummary="True"
                                                ShowGroupedColumns="True"
                                                IsEnabled="True"
                                                AllowEditing="False"
                                                AllowDrop="False"
                                                AllowFixedColumnMenu="True" />
                                </dxg:GridControl.View>
                            </dxg:GridControl>
                        </Grid>
                    </dx:DXTabItem>
                    <dx:DXTabItem Header="Отчет (Учет топлива)">
                        <Grid>
                            <dxg:GridControl Name="FuelRep" AutoPopulateColumns="True">
                                <dxg:GridControl.View>
                                    <dxg:TableView 
                                                AutoWidth="True" 
                                                ShowFilterPanelMode="ShowAlways"
                                                ShowAutoFilterRow="True"
                                                ShowTotalSummary="True"
                                                ShowGroupedColumns="True"
                                                IsEnabled="True"
                                                AllowEditing="False"
                                                AllowDrop="False"
                                                AllowFixedColumnMenu="True" />
                                </dxg:GridControl.View>
                            </dxg:GridControl>
                        </Grid>
                    </dx:DXTabItem>
                </dx:DXTabControl>
            </TabItem>
        </TabControl>
    </DockPanel>
</Window>
